package com.example.controller;

import com.example.entity.ComplaintUsers;
import com.example.entity.Page.PageRequest;
import com.example.result.CommonResult;
import com.example.service.ComplaintUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: tobed
 * @date: 2022/11/17
 * @time: 20:50
 */
@RestController
@RequestMapping("complaintUsers")
public class ComplaintUsersController {

    @Autowired
    ComplaintUsersService service;

    /*全查*/
    @GetMapping("list")
    public CommonResult list(PageRequest pageRequest, ComplaintUsers complaintUsers){
        CommonResult commonResult = service.list(pageRequest,complaintUsers);
        return commonResult;
    }

    /*删除*/
    @PostMapping("remove/{id}")
    public CommonResult remove(@PathVariable Integer id){
        CommonResult commonResult = service.remove(id);
        return commonResult;
    }

    /*修改*/
    @PostMapping("update")
    public CommonResult update(@RequestBody ComplaintUsers complaintUsers){
        CommonResult commonResult = service.update(complaintUsers);
        return commonResult;
    }

    /*新增*/
    @PostMapping("create")
    public CommonResult create(@RequestBody ComplaintUsers complaintUsers){
        CommonResult commonResult = service.create(complaintUsers);
        return commonResult;
    }


}
